package com.example.kaoqinmanager.activity;


import android.os.Bundle;
import android.view.MenuItem;

import androidx.recyclerview.widget.LinearLayoutManager;

import com.example.kaoqinmanager.adapter.RecordAdapter;
import com.example.kaoqinmanager.base.BaseBindingActivity;
import com.example.kaoqinmanager.bean.DaKaTable;
import com.example.kaoqinmanager.databinding.ActivityRecordBinding;

import org.litepal.LitePal;

import java.util.List;

public class RecordActivity extends BaseBindingActivity<ActivityRecordBinding> {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        actionBar.setTitle("打卡记录");
        //显示返回箭头默认是不显示的
        actionBar.setDisplayHomeAsUpEnabled(true);


        List<DaKaTable> kaTableList = LitePal.findAll(DaKaTable.class);
        System.out.println(".onCreate kaTableList="+kaTableList.size());

        RecordAdapter recordAdapter = new RecordAdapter(this, kaTableList);
        getBinding().mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
        getBinding().mRecyclerView.setAdapter(recordAdapter);

    }


    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            //actionbar的左侧图标的点击事件处理
            case android.R.id.home:
                finish();
                break;
        }
        return super.onOptionsItemSelected(item);
    }
}